package com.bto.solar.work.service.biz_stage_handler;

import com.bto.solar.work.common.BizException;
import com.bto.solar.work.constant.BizStageEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

/**
 * @author 王小波
 * @description:
 * @date 2023/7/31 16:53
 */

@Component
public class StageHandlerFactory {
    @Autowired
    @Lazy
    private YuShenStageHandler yuShenStageHandler;
    @Autowired
    @Lazy
    private YeZhuStageHandler yeZhuStageHandler;
    @Autowired
    @Lazy
    private KanChaStageHandler kanChaStageHandler;
    @Autowired
    @Lazy
    private LeaseSyncProjectHandler leaseSyncProjectHandler;
    @Autowired
    @Lazy
    private LeaseSignedHandler leaseSignedHandler;
    @Autowired
    @Lazy
    private BeiAnZhengXingxiHandler beiAnZhengXingxiHandler;
    @Autowired
    @Lazy
    private DesignStageHandler cspsStageHandler;
    @Autowired
    @Lazy
    private ShiGongStageHandler shiGongStageHandler;
    @Autowired
    @Lazy
    private BingWangStageHandler bingWangStageHandler;
    @Autowired
    @Lazy
    private JieSuanStageHandler jieSuanStageHandler;
    @Autowired
    @Lazy
    private GSContractStageHandler gsContractStageHandler;

    public StageHandler getLeaseStageHandlerByStatusId(String stageId){
        if (BizStageEnum.PRE_APPROVAL.getStageId().equals(stageId)) {
            return yuShenStageHandler;
        }else if (BizStageEnum.CUSTOMER_INFO.getStageId().equals(stageId)) {
            return yeZhuStageHandler;
        } else if (BizStageEnum.KAN_CHA.getStageId().equals(stageId)) {
            return kanChaStageHandler;
        } else if (BizStageEnum.LEASE_SYNC_PROJECT.getStageId().equals(stageId)) {
            return leaseSyncProjectHandler;
        } else if (BizStageEnum.LEASE_SIGN.getStageId().equals(stageId)) {
            return leaseSignedHandler;
        }else if (BizStageEnum.BAZING.getStageId().equals(stageId)) {
            return beiAnZhengXingxiHandler;
        } else if (BizStageEnum.DESIGN.getStageId().equals(stageId)) {
            return cspsStageHandler;
        } else if (BizStageEnum.CONSTRUCT.getStageId().equals(stageId)) {
            return shiGongStageHandler;
        } else if (BizStageEnum.GRID_CONNECTION.getStageId().equals(stageId)) {
            return bingWangStageHandler;
        } else if (BizStageEnum.SETTLEMENT.getStageId().equals(stageId)) {
            return jieSuanStageHandler;
        } else if (BizStageEnum.GS_CONTRACT.getStageId().equals(stageId)) {
            return gsContractStageHandler;
        }
        else {
            throw new BizException("没有对应的阶段处理器 {}" ,stageId);
        }

    }


}
